package com.recruit.wechat.controller;


import com.recruit.wechat.controller.model.ApiResultModel;
import org.springframework.web.bind.annotation.RequestMapping;
import com.recruit.wechat.bean.result.ResultPage;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;

import com.recruit.wechat.bean.WechatWanted;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 肖守凯
 * @since 2020-08-24
 */
@Controller
@RequestMapping("/WeChatUser/wechatWanted")
public class WechatWantedController extends BaseController{
     /** 主页面 */
    @RequestMapping("admin/main.html")
    public String main(){
       return  "Wechatwanted/WechatwantedMain";
    }
    /** 添加页面跳转
     * @return 返回页面
     */
    @RequestMapping(value = "admin/addWechatWantedHtml")
    public String addWechatWantedHtml( ){
             return "Wechatwanted/WechatwantedAdd";
    }
    /** 编辑页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/editWechatWantedHtml")
    public String editWechatWantedHtml(Integer id ,Model model ){
           model.addAttribute("wechatWanted",wechatWantedService.selectWechatWantedByIdWechatWanted(id));
             return "Wechatwanted/WechatWantedEdit";
    }

    /** 查看页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/showWechatWantedHtml")
    public String showWechatWantedHtml(Integer id ,Model model ){
           model.addAttribute("wechatWanted",wechatWantedService.selectWechatWantedByIdWechatWanted(id));
             return "Wechatwanted/WechatWantedShow";
    }


    /** 分页查询WechatWanted
     * @param page  页码
     * @param limit  查几条
     * @param wechatWanted  前端传进的参数
     * @return 返回统一分页信息
     */
    @RequestMapping(value = "admin/findWechatWantedByPage")
    @ResponseBody
    public ResultPage findWechatWantedByPage(Integer page, Integer limit,WechatWanted wechatWanted){
             return wechatWantedService.findWechatWantedByPage(page,limit,wechatWanted);
    }

    /** 添加WechatWanted
     * @param wechatWanted  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/addWechatWanted")
    @ResponseBody
    public ApiResultModel saveWechatWanted(WechatWanted wechatWanted  ){
             return wechatWantedService.addWechatWanted(wechatWanted);
    }

    /** 编辑WechatWanted
     * @param wechatWanted  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/editWechatWanted")
    @ResponseBody
    public ApiResultModel editWechatWanted(WechatWanted wechatWanted  ){
             return wechatWantedService.editWechatWanted(wechatWanted);
    }



    /** 删除一条WechatWanted
     * @param id  前端传进的ID
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/delWechatWanted")
    @ResponseBody
    public ApiResultModel delWechatWanted( Integer id  ){
             return wechatWantedService.delWechatWanted(id);
    }


}
